package nl.hanze.web.t41.http;

import java.io.File;

public class SimpleAuth implements DirectoryAuth {

	private File priveDir;
	private static final String username = "admin";
	private static final String password = "P@$$w0rd";
	
	
	public SimpleAuth() {
		priveDir = new File(HTTPServer.webRoot.getPath() + HTTPServer.dirSep + "prive");
	}

	public boolean authorize(File dir, String username, String password) {
		return (requiresAuthorization(dir) && 
				username.equals(SimpleAuth.username) &&
				password.equals(SimpleAuth.password));
	}

	public boolean requiresAuthorization(File dir) {
		return dir.equals(priveDir);
	}
}